﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Facebook;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using quinielonModel;


public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        var fbApp = Utils.getAppInfo();
        Response.Redirect("https://www.facebook.com/dialog/oauth?client_id="+fbApp.appId+"&redirect_uri=http://chiquiniela.skan4labs.com/home.aspx&scope=offline_access,user_status,publish_stream,email,manage_pages,user_groups");
        //Response.Redirect("https://www.facebook.com/dialog/oauth?client_id="+fbApp.appId+"&redirect_uri=http://localhost:1730/Des/home.aspx&scope=offline_access,user_status,publish_stream,email,manage_pages,user_groups");

       //ASPNETDBDataContext dbRO= new ASPNETDBDataContext();
        //dbRO.ObjectTrackingEnabled = false;

        //string fbUser = "512041756";
        //string getAccessToken=(From u In dbRO.usuariosLogs Where u.fb_user_id = dynamicUsername Select u.fb_session).SingleOrDefault();
        //quinielonEntities quini = new quinielonEntities();
        //var getAccessToken = (from u in quini.usuario where u.id_fb.Equals(fbUser) select u.token).SingleOrDefault();
        //usuario usu = (from u in quini.usuario where u.id_fb.Equals(fbUser) select u).FirstOrDefault();
        //usuario nuevo = new usuario();
        //nuevo.id_fb = "1111111123";
        //quini.usuario.AddObject(nuevo);
        //quini.SaveChanges();
         


        //quini.Dispose();
        //if(!getAccessToken.Equals(null))
        //{
        //    var FBApp = new FacebookClient(getAccessToken);
        //    var fbStatus=new ExpandoObject();
        //    //fbStatus.message="Test";
        //    //FBApp.Post("/feed", fbStatus);
        //}

        //Dim getAccessToken = (From u In dbRO.usuariosLogs Where u.fb_user_id = dynamicUsername Select u.fb_session).SingleOrDefault()
       
    }
}